//
//  YHYCompanyAddPictureCell.m
//  Home
//
//  Created by 杨泓晔 on 16/6/23.
//  Copyright © 2016年 LanJue. All rights reserved.
//

#import "YHYCompanyAddPictureCell.h"

@interface YHYCompanyAddPictureCell ()

@end


@implementation YHYCompanyAddPictureCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubView];
        self.contentView.backgroundColor = [UIColor whiteColor];
    }
    
    return self;
}

- (void)createSubView {
    self.backView = [UIView new];
    [self addSubview:self.backView];
    [self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.mas_equalTo(self);
        make.height.mas_equalTo(self);
        make.width.mas_equalTo(self);
    }];
    self.backView.backgroundColor = LV;
   // self.backView.backgroundColor = [UIColor redColor];
    
    
    
    _myImageView = [UIImageView new];
    [self.backView addSubview:_myImageView];
    [_myImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.width.mas_equalTo(_backView);
        make.height.mas_equalTo(750/ 3 * AUTO_HEIGHT);
        
    }];
    _myImageView.backgroundColor = [UIColor whiteColor];
    
    
    
    UIImageView *imageView = [UIImageView new];
    [self.backView addSubview:imageView];
    imageView.image = [UIImage imageNamed:@"虚线"];
    [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(0.7 * AUTO_HEIGHT);
        make.left.mas_equalTo(0);
        make.width.mas_equalTo(self.backView);
        make.bottom.mas_equalTo(- 50 * AUTO_HEIGHT);
        
    }];
    
    _deleteButton = [UIButton new];
    [self.backView addSubview:_deleteButton];
    [_deleteButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    [_deleteButton setTitle:@"删除" forState:UIControlStateNormal];
    [_deleteButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(imageView.mas_bottom);
        make.left.mas_equalTo(self.backView);
        make.width.mas_equalTo(SCREEN_WIDTH/3);
        make.height.mas_equalTo(120 /3 * AUTO_HEIGHT);
        
    }];
    _deleteButton.tag = 1000;
    _deleteButton.titleLabel.font = [UIFont fontWithName:@"Arial" size:TEXTCONTENTFONT * TEXTWEIGHT];
    [_deleteButton addTarget:self action:@selector(Action:) forControlEvents:UIControlEventTouchUpInside];
    _deleteButton.backgroundColor = [UIColor whiteColor];
    
    
    UIImageView *ine1 = [UIImageView new];
    [self.backView addSubview:ine1];
    ine1.image = [UIImage imageNamed:@"虚线竖"];
    [ine1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_deleteButton.mas_top).offset(8 * AUTO_HEIGHT);;
        
        make.width.mas_equalTo(.7 * AUTO_WIDTH);
        make.bottom.mas_equalTo(- 8 * AUTO_HEIGHT);
        make.left.mas_equalTo(_deleteButton.mas_right);
        
    }];
    
    
    _moveUPButton = [UIButton new];
    [self.backView addSubview:_moveUPButton];
    [_moveUPButton setTitleColor:GH forState:UIControlStateNormal];
    [_moveUPButton setTitle:@"上移" forState:UIControlStateNormal];
    [_moveUPButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(imageView.mas_bottom);
        make.left.mas_equalTo(_deleteButton.mas_right);
        make.width.mas_equalTo(SCREEN_WIDTH/3);
        make.height.mas_equalTo(120 /3 * AUTO_HEIGHT);
        
    }];
    _moveUPButton.tag = 1001;
    _moveUPButton.backgroundColor = [UIColor whiteColor];
    _moveUPButton.titleLabel.font = [UIFont fontWithName:@"Arial" size:TEXTCONTENTFONT * TEXTWEIGHT];
    [_moveUPButton addTarget:self action:@selector(Action:) forControlEvents:UIControlEventTouchUpInside];
    

    
    UIImageView *ine2 = [UIImageView new];
    [self addSubview:ine2];
    ine2.image = [UIImage imageNamed:@"虚线竖"];
    [ine2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_deleteButton.mas_top).offset(8 * AUTO_HEIGHT);;
        
        make.width.mas_equalTo(.7 * AUTO_WIDTH);
        make.bottom.mas_equalTo(- 8 * AUTO_HEIGHT);
        make.left.mas_equalTo(_moveUPButton.mas_right);
        
    }];
    

    
    
    
    
    _downButton = [UIButton new];
    [self.backView addSubview:_downButton];
    [_downButton setTitleColor:GH forState:UIControlStateNormal];
    [_downButton setTitle:@"下移" forState:UIControlStateNormal];
    [_downButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(imageView.mas_bottom);
        make.left.mas_equalTo(_moveUPButton.mas_right);
        make.width.mas_equalTo(SCREEN_WIDTH/3);
        make.height.mas_equalTo(120 /3 * AUTO_HEIGHT);
        
    }];
    _downButton.tag = 1002;
    _downButton.backgroundColor = [UIColor whiteColor];
    _downButton.titleLabel.font = [UIFont fontWithName:@"Arial" size:TEXTCONTENTFONT * TEXTWEIGHT];
    [_downButton addTarget:self action:@selector(Action:) forControlEvents:UIControlEventTouchUpInside];
    
    
    

}

//- (void)setMyImageView:(UIImageView *)myImageView{
//   
//   
//     _myImageView = myImageView;
//  //  [self imageCompressForSize:_myImageView.image targetSize:CGSizeMake(SCREEN_WIDTH, 150/3 * AUTO_HEIGHT)];
//}




- (void)Action:(UIButton *)btu{
    [self.delegate buttonAction:btu];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
